from distutils.core import setup, Extension
from Cython.Build import cythonize
import os, shutil


module_name = "exam"
pyx_name = "exam"
include_files = [f"pyx/{pyx_name}.pyx",]

ext = Extension(name=module_name, sources=include_files,  language_level=3)
setup(ext_modules=cythonize(ext, annotate=True, build_dir="build"))

with open(f"build/lib.win-amd64-cpython-310/{module_name}.cp310-win_amd64.pyd", 'rb') as src, open(f"Libs/{module_name}.pyd", 'wb') as dest:
        dest.write(src.read())

with open(f"build/pyx/{pyx_name}.html", 'rb') as src, open(f"verify/{pyx_name}.html", 'wb') as dest:
        dest.write(src.read())

remove_path = "build"
if os.path.exists(remove_path):
        shutil.rmtree(remove_path)